package com.nmbb.oplayer.service;

import com.nmbb.oplayer.ui.MainActivity;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;

public class mBootBroadcastReceiver extends BroadcastReceiver {

	static final String ACTION = "android.intent.action.BOOT_COMPLETED";
//	private Context mContext;
//	@SuppressLint("HandlerLeak")
//	private Handler handler = new Handler() {
//		@SuppressWarnings("deprecation")
//		public void handleMessage(android.os.Message msg) {
//			//if(Settings.Secure.getInt(mContext.getContentResolver(),Settings.Secure.DEVICE_PROVISIONED, 0) == 1) {
//				handler.sendEmptyMessageDelayed(0, 3000);
//				Intent basibosIntent = new Intent(mContext, MainActivity.class);
//				//basibosIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//				mContext.startActivity(basibosIntent);			
//			//}else {
//			//	handler.sendEmptyMessageDelayed(0, 15000);
//			//}
//		};
//	};
//
//	@Override
//	public void onReceive(Context context, Intent intent) {
//		if (intent.getAction().equals(ACTION)) {
//			this.mContext = context;
//			Message msg = handler.obtainMessage();
//			msg.sendToTarget();
//		}
//	}
	
	@Override  
    public void onReceive(Context context, Intent intent) {  
        if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {  
            Intent intent2 = new Intent(context, MainActivity.class);   
            intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
            context.startActivity(intent2);  
        }  
    }  

}
